Skip to content

fix: preserve image tool results for Claude - #8

Closed
lantzleiweke wants to merge 1 commit into
openchamber:mainfrom
lantzleiweke:fix/tool-result-image-attachments
Closed

lantzleiweke wants to merge 1 commit into
openchamber:mainfrom
lantzleiweke:fix/tool-result-image-attachments

Conversation

@lantzleiweke

Copy link
Copy Markdown

Summary

  • preserve multimodal OpenCode tool results when resuming parked Claude SDK tool calls
  • convert base64 image attachments to MCP-native image content blocks
  • keep text and image blocks together through the bridge resolver

Root cause

collectToolResults() reduced every tool response to extractTextContent(), and the SDK MCP handler rebuilt a text-only result. OpenCode had stored the PNG attachment correctly, but the provider bridge discarded it before Claude received the tool result.

Verification

  • bun test/smoke.ts
  • bun run build
  • regression fixture confirms text plus PNG data URL converts to MCP { type: "image", data, mimeType } content

JosueGalRe added a commit to JosueGalRe/opencode-claude that referenced this pull request Sep 22, 2026
…d media

Tool results were reduced to text before resuming the parked SDK call, so
read-tool images never reached the model. Convert attachments to MCP image
content blocks, and merge the synthetic 'Attached media from tool result:'
user message OpenCode emits for openai-compatible providers.

Upstream: openchamber#8 + media part of openchamber#11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant